<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>奖惩信息查询</title>
    <link rel="stylesheet" href="./login.css">
    <script>
        function login() {
            window.location = "AP.php";
        }
    </script>
</head>
<body>
    <div class="loginCard">
            <h1 >
                <style>
                    h1{
                        text-align: center;
                    }
                </style>
                奖惩信息
            </h1>
            <?php
                 header("Content-type:text/html;charset=utf-8");
                 $con = mysqli_connect("localhost", 'root', '', 'ksdb2');
                 mysqli_set_charset($con, "utf8");

                 $ap_id = $_GET['ap_id'];
                 $sql="select ap_id,dpt_name,mj_name,award_punish.st_id,st_name,ap_name,ap_project 
                 from student, award_punish, major, department ,class
                 where award_punish.st_id = student.st_id and class.mj_id = major.mj_id and major.dpt_id = department.dpt_id and award_punish.ap_id = '$ap_id' and student.cl_id = class.cl_id;";
                 $result = mysqli_query($con,$sql);
                 echo "<table border='1'><tr>
                 <th>奖惩号</th>
                 <th>院系</th>
                 <th>专业</th>
                 <th>学号</th>
                 <th>姓名</th>
                 <th>奖惩名</th>
                 <th>奖惩方案</th>
                 </tr>";
                 $row = mysqli_fetch_array($result);
                    echo "<tr>";
                    echo "<td>" . $row['ap_id'] . "</td>";
                    echo "<td>" . $row['dpt_name'] . "</td>";
                    echo "<td>" . $row['mj_name'] . "</td>";
                    echo "<td>" . $row['st_id'] . "</td>";
                    echo "<td>" . $row['st_name'] . "</td>";
                    echo "<td>" . $row['ap_name'] . "</td>";
                    echo "<td>" . $row['ap_project'] . "</td>";
                    echo "<tr>";
                 
                 echo "</table>";
 
	             mysqli_close($con);
            ?>
            
            <br>
            
            <div>
                
                <button type="button" onclick="login()">返回</button>
                
            </div>
            
            